You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
611 B
16 lines
611 B
import { defineWrappedResponseHandler } from "#server/utils/handler";
|
|
import { R } from "#server/utils/response";
|
|
import { getCharacterCardBySlug } from "#server/service/character/character-card";
|
|
import { parseTags } from "#server/service/character/persona";
|
|
|
|
export default defineWrappedResponseHandler(async (event) => {
|
|
const slug = getRouterParam(event, "slug");
|
|
if (!slug) {
|
|
return R.error("参数无效", null);
|
|
}
|
|
const card = await getCharacterCardBySlug(slug);
|
|
if (!card) {
|
|
return R.error("角色不存在", null);
|
|
}
|
|
return R.success({ ...card, tags: parseTags(card.tags) });
|
|
});
|
|
|